/*
Date:20210512 23:34PM
key:核心 记录一长串异或结果 要求某个就让长结果异或短结果
*/
class Solution {
public:
    vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) 
    {
        int*v=new int[arr.size()];
        int re;
        for(int i=0;i<arr.size();i++)
        {
            if(i==0){v[0]=arr[i];}
            else{v[i]=v[i-1]^arr[i];}
        }
        vector<int>v2;
        v2.resize(queries.size());
        int j=0;
        for(vector<int>&v1:queries)
        {
            if(v1[0]>0){
                //if(v1[0]==v1[1]){v2[j]=arr[v1[0]];continue;}
                v2[j]= v[v1[1]]^v[v1[0]-1];
            }
            else{
                v2[j]= v[v1[1]];
            }
            j++;
        }
        return v2;
    }
};